<?php

// +----------------------------------------------------
// | Name: 星空框架  用户验证规则
// +----------------------------------------------------
// | Version: V5.0
// +----------------------------------------------------
// | Author: xkyinzhe <zhonghuaxinxing@sina.cn>
// +----------------------------------------------------
// | Time： 2021-05-07 13：01
// +----------------------------------------------------
declare(strict_types=1);

namespace app\common\validate;

use app\common\model\User as UserModel;

use think\Validate;

/**
 * @xk 用户验证模型
 */
class User extends Validate
{
    protected $rule = [
    'tel' => 'mobile',
    'user_sn' => 'require|number|min:6',
    'pass' => 'require|number|length:6',
    'old_pass' => 'require|number|length:6',
    'pass1' => 'require|number|length:6|confirm:pass',
    'captch' => 'number|length:6',
    'code|微信code' => 'require',
    'user_name' => 'require',
    'head_pic|用户头像' => 'require',
    'encryptedData|微信encryptedData' => 'require',
    'iv|微信iv' => 'require',
    'card_num|身份证号码' => 'idCard',
    'idCard' => 'idCard',
    'bankName' => 'require|chsAlpha',
    'account' => 'require|alphaNum'
  ];
    protected $message = [
    'user_sn' => '请输入正确的会员号',
    'tel.mobile' => '请输入正确的手机号码',
    'tel.checkMobile' => '手机号已经存在，请登陆或更换手机号注册',
    'pass.require' => '请输入新密码（请设置6位数字密码）',
    'pass.length' => '请设置6位数字密码',
    'pass1.require' => '请再次输入密码',
    'pass1' => '两次密码不一致，请重新输入',
    'old_pass' => '原始密码必须是6位纯数字',
    'captch.require' => '请输入手机验证码',
    'captch' => '验证码错误请重新输入',
    'code' => '微信Code不可为空',
    'user_name' => '请填写昵称',
    'head_pic' => '请上传头像',
    'encryptedData' => '微信EncryptedData不可为空',
    'iv' => '微信iv不可为空',
    'card_num' => '请正确填写身份证号',
    'idCard' => '身份证号码有误，无法继续提交',
    'bankName' => '请正确输入银行卡信息',
    'account' => '请输入正确的银行卡号',
  ];
  protected $scene = [
    'register' => ['tel', 'pass', 'captch'],
    'login' => ['tel','pass'],
    'forget' => ['tel','psss'],
    'chanagetel' => ['tel','captch'],
    'chanageAvatar' => ['head_pic'],
    'chanageNickname' => ['user_name'],
    'chanageSave' => ['user_name','head_pic'],
    'editPass' => ['pass','pass1','old_pass'],
    'WeChatLogin' => [],
    'userSnLogin' => ['user_sn','pass'],
    'cardNum' => ['card_num'],
    'pass_login' => ['tel','pass'],
    'captch_login' => ['tel','captch'],
    'chanageBank' => ['idCard','account','name']
  ];
}
 